package com.nativelibs4java.buswing;

import javax.swing.table.AbstractTableModel;

public class DummyTableModel extends AbstractTableModel {
	Object[][] data;
	String[] columns;
	public DummyTableModel(String[] columns, Object[][] data) {
		this.data = data;
		this.columns = columns;
	}
	@Override
	public String getColumnName(int column) {
		return columns[column];
	}
	@Override
	public int getColumnCount() {
		return data.length == 0 ? 0 : data[0].length;
	}
	@Override
	public int getRowCount() {
		return data.length;
	}
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
        try {
            return data[rowIndex][columnIndex];
        } catch (ArrayIndexOutOfBoundsException ex) {
            return null;
        }
	}
}